object Application {
  def main(args: Array[String]): Unit = {
    println(func1(1))
    println(add1(1, 2))
    val a = raw"a"
    val b = """b"""

    {
      val te1: Any => Any = {
        case a: Int => a * 2
        case value => value
      }
      println(te1.getClass) //class Application$$$Lambda$5/1626877848
      println(te1.apply(2)) //trait Function1
      println(te1.apply("2"))

    }

    val r = new Rational(1, 2)
    r.d
  }

  def func1(x: Int) {
    val xx = 1 :: 2 :: 3 :: Nil
    val x = ("a", 2)
    x._1
    x
  }

  def add(x: Int, y: Int) {
    x + y

  }

  def add1(x: Int, y: Int) = {
    x + y
    -8 toLong
  }

  class Rational(n: Int, val d: Int) {
    require(d != 0)
    println("Created " + n + "/" + d) //会在构造函数里执行

    override def toString: String = "Rational " + n + "/" + d

    def < (that: Rational): Boolean = {
      this.d < that.d
    }
  }

}